package com.wtwd.device.controller;


import com.wtwd.device.model.dto.AppConfigurationDTO;
import com.wtwd.device.model.vo.ResultVO;
import com.wtwd.device.service.AppConfigurationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author zdl
 * @date 2023/10/25 16:41
 */
@Api(tags = "App配置")
@RestController
@RequestMapping("app-config")
public class AppConfigurationController {

    @Resource
    private AppConfigurationService appConfigurationService;

    @ApiOperation(value = "获取")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", required = true, dataType = "long")
    })
    @GetMapping("get")
    public ResultVO<AppConfigurationDTO> get(@RequestParam Long id) {
        return ResultVO.success(appConfigurationService.getById(id));
    }

    @ApiOperation(value = "添加")
    @PostMapping("add")
    public ResultVO add(@RequestBody AppConfigurationDTO appConfigurationDTO) {
        appConfigurationService.add(appConfigurationDTO);
        return ResultVO.success();
    }
}
